package com.base.interceptor;

import java.io.IOException;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter;

public class MyStrutsFilterDispatcher extends StrutsPrepareAndExecuteFilter {
 
//	public void doFilter(ServletRequest req,ServletResponse res,FilterChain chain) throws IOException
//	{
//		HttpServletRequest request =(HttpServletRequest) req;
//		String uri = request.getRequestURI();
//		String[] uriArray = uri.split("/feckeditor/editor/filemanager/connectors/");
//		int len = uriArray.length;
//		try {
//		if(len>=2){
//			
//				chain.doFilter(req, res);
//		}else{
//			super.doFilter(req, res, chain);
//		}
//		}catch (ServletException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		}
//	}
	
	 public void doFilter(ServletRequest req, ServletResponse res,
	            FilterChain chain) throws IOException, ServletException {
	        HttpServletRequest request = (HttpServletRequest) req;
	        if (request.getRequestURI().indexOf("fckeditor") != -1) {
	            chain.doFilter(req, res);
	        } else {
	            super.doFilter(req, res, chain);
	        }
	    }

}
